// 基础响应类型
export interface BasicMsg {
  operateResult: 'SUCC' | 'UNSUSS';
  errorMsg: string;
  errorCode: string;
}

export interface BasicMsgWithData<T> extends BasicMsg {
  data: T | null;
}

// 用户相关类型
export interface User {
  userId?: number;
  username: string;
  nickname: string;
  email?: string;
  phonenumber?: string;
  sex?: '0' | '1' | '2'; // 0男 1女 2未知
  avatar?: string;
  password?: string;
  status?: '0' | '1'; // 0正常 1停用
  createTime?: string;
  updateTime?: string;
  userType?: '0' | '1'; // 0管理员 1普通用户
}

// 菜品相关类型
export interface Dish {
  dishId?: number;
  dishName: string;
  dishType: string;
  dishPrice: number;
  dishImage?: string;
  dishDescription?: string;
  dishSpecification?: string;
  dishMaterials?: string;
  dishStatus?: '0' | '1'; // 0正常 1停售
  salesCount?: number;
  createTime?: string;
  updateTime?: string;
  remark?: string;
}

// 购物车相关类型
export interface CartItem {
  cartId?: number;
  userId: number;
  dishId: number;
  quantity: number;
  createTime?: string;
  updateTime?: string;
  // 扩展字段（用于前端展示）
  dish?: Dish;
}

// 订单相关类型
export interface Order {
  orderId?: number;
  orderNo?: string;
  userId: number;
  totalAmount: number;
  orderStatus?: '0' | '1' | '2' | '3'; // 0待支付 1已支付 2已完成 3已取消
  paymentMethod?: string;
  paymentTime?: string;
  deliveryAddress: string;
  contactPhone: string;
  contactName: string;
  remark?: string;
  createTime?: string;
  updateTime?: string;
}

export interface OrderDetail {
  detailId?: number;
  orderId: number;
  dishId: number;
  dishName: string;
  dishPrice: number;
  quantity: number;
  subtotal: number;
  createTime?: string;
}

// 评论相关类型
export interface Comment {
  commentId?: number;
  orderId: number;
  userId: number;
  dishId: number;
  rating: number;
  commentContent: string;
  commentImages?: string;
  commentStatus?: '0' | '1'; // 0正常 1隐藏
  createTime?: string;
  updateTime?: string;
  // 扩展字段（用于前端展示）
  user?: User;
  dish?: Dish;
}

// 收藏相关类型
export interface Favorite {
  favoriteId?: number;
  userId: number;
  dishId: number;
  createTime?: string;
  // 扩展字段（用于前端展示）
  dish?: Dish;
}

// 登录请求
export interface LoginRequest {
  username: string;
  password: string;
}

// 注册请求
export interface RegisterRequest {
  username: string;
  password: string;
  nickname: string;
  email?: string;
  phonenumber?: string;
  sex?: '0' | '1' | '2';
  userType?: '0' | '1'; // 0管理员 1普通用户
}

// 创建订单请求
export interface CreateOrderRequest {
  userId: number;
  deliveryAddress: string;
  contactPhone: string;
  contactName: string;
  remark?: string;
}

// 创建评论请求
export interface CreateCommentRequest {
  orderId: number;
  userId?: number;
  dishId?: number;
  rating: number;
  commentContent: string;
  commentImages?: string;
  commentStatus?: '0' | '1';
}

